﻿using System;
using System.Collections;
using System.Configuration;
using System.Reflection;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using AnyOffice.Components;
using AnyOffice.DAL;
using System.Text;
using log4net;

namespace AnyOffice.general.mytable
{
    public partial class address : System.Web.UI.UserControl
    {
        private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                SqlConnection conn = new SqlConnection(ConfigManager.ConnectionString);
                DataTable table = new AddressGroupDao().SelectAll(conn, "");
                StringBuilder builder = new StringBuilder();
                builder.Append("<select name=\"ddlGroupId\" id=\"sltGroupId_\" class=\"SmallSelect\">");
                builder.Append("<option value=\"all\">所有</option>");
                builder.Append("<option value=\"0\">默认</option>");
                if (table.Rows.Count > 0)
                {
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        builder.Append("<option value=\"" + table.Rows[i]["GroupId"].ToString() + "\">" + table.Rows[i]["GroupName"].ToString() + "</option>");
                    }
                }
                builder.Append("</select>");
                conn.Close();
                this.litGroupId.Text = builder.ToString();
            }
            catch (Exception exception)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("", exception);
                }
            }
        }
      

    }
}